package com.vision.world.survey.presenter;

import android.content.Context;

import com.vision.world.survey.R;
import com.vision.world.survey.adapters.LayerSettingAdapter;
import com.vision.world.survey.Interface.view.ISettingLayerView;

/**
 * Created by Ada on 2017/10/12.
 * SettingLayerFragment P层
 */

public class SettingLayerPresenter {
    public LayerSettingAdapter mLayerSettingAdapter=null;
    private ISettingLayerView listenerView;
    private Context mContext=null;

    public SettingLayerPresenter(Context context,ISettingLayerView listener ){
        listenerView = listener;
        mContext=context;
    }

    public LayerSettingAdapter getLayerSettingAdapter(){
        mLayerSettingAdapter=new LayerSettingAdapter(mContext);
        return mLayerSettingAdapter;
    }

    public void changeBaseLayerDisplay(int position){
        if( LayerSettingAdapter.checkIndex!=position){
            LayerSettingAdapter.checkIndex=position;
            mLayerSettingAdapter.notifyDataSetChanged();
            String url;
            if(position==0){
                url=mContext.getResources().getString(R.string.china_online_community_service);
            }else{
                url=mContext.getResources().getString(R.string.world_imagery_service);
            }
            listenerView.changeLayer(url);
        }
    }
}
